<?php

namespace App\Model;

class OrderChildsModel extends BaseModel
{
    protected $table = 'order_childs';

    protected $primaryKey = 'order_child_id';
    protected $fillable = [
        'user_id',
        'order_code',
        'json_data',
        'project_id',
        'type',
        'price',
        'nums',
        'is_song',
        'sku_attributes_txt',
        'sku_attritubes',
    ];

    public function projectInfo(){
        return $this->hasOne(ProjectsModel::class,'project_id','project_id');
    }

    public function userInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(UsersModel::class,'user_id','user_id');
    }

    public function he_shops_user(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(UsersModel::class,'user_id','h_user_id');
    }

    public function orderInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(OrdersModel::class,'order_code','order_code');
    }
}
